package StudyCode.summary.mycollection;

import java.util.Iterator;
import java.util.Map;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class SearchMap {
	public static String searchMap(Map hm, String searchFor) {

		Iterator i = hm.entrySet().iterator();
		String newName = null;

		while (i.hasNext()) {

			Map.Entry entry = (Map.Entry) i.next();
			String key = (String) entry.getKey();
			String value = (String) entry.getValue();

			if (key.equals(searchFor)) {
				newName = value;
			}

			if (value.equals(searchFor)) {
				newName = key;
			}

		}

		return newName;

	}
}
